﻿// Decompiled with JetBrains decompiler
// Type: cXMLWizard.CCoCXMLWizardCmd
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using DnProcessSimulateCommands.OLPEditor.cXMLWizard.Resources;
using System.IO;
using System.Windows.Forms;
using Tecnomatix.Engineering;


namespace cXMLWizard;

public class CCoCXMLWizardCmd : TxButtonCommand
{
  private TxCommandTypeFilterEnabler _enabler;

  public virtual bool Licensed => true;

  public CCoCXMLWizardCmd()
  {
    this._enabler = new TxCommandTypeFilterEnabler((ITxTypeFilter) new TxTypeFilter(typeof (ITxRobot)), true);
  }

  public virtual string Name => cXMLWizardStringTable.NAME;

  public virtual string Category => cXMLWizardStringTable.CATEGORY;

  public virtual ITxCommandEnabler CommandEnabler => (ITxCommandEnabler) this._enabler;

  public virtual string Bitmap => "OLPEditor.cXMLWizard.Resources.Button.bmp";

  public virtual void Execute(object cmdParams)
  {
    TxRobot lastPickedItem = TxApplication.ActiveSelection.GetLastPickedItem() as TxRobot;
    if (TxRobot.op_Equality(lastPickedItem, (ITxObject) null))
      return;
    if (!Directory.Exists(new TxOLPUtilities().GetOLPInstallationDirectory() + lastPickedItem.Controller.Name))
      TxMessageBox.ShowModal($"{lastPickedItem.Controller.Name} {cXMLWizardStringTable.CONTROLLER_NOT_INSTALLED_MESSAGE}", "", MessageBoxButtons.OK, MessageBoxIcon.None);
    else
      ((Control) new CUiMainwindow()).Show();
  }
}
